﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BloomFilter.String
{
    public class StringBloomFilterManager : BloomFilterManager<StringBloomFilter, string>
    {
        public StringBloomFilterManager(int filterSize, int nKey, string basePath, uint maxFilterCount = 0)
            : base(filterSize, nKey, basePath, maxFilterCount) { }

        protected override void CopyToBuffer(StringBloomFilter myFilter, ref byte[] myBuffer)
        {
            myFilter.CopyToBuffer(ref myBuffer);
        }

        protected override StringBloomFilter GetNewFilter(byte[] myBuffer)
        {
            return new StringBloomFilter(myBuffer, nKey);
        }

        protected override StringBloomFilter GetNewFilter(int byteSize, int nKeys)
        {
            return new StringBloomFilter(byteSize, nKey);
        }

        protected override bool IsHaveValue(StringBloomFilter bFilter, string val)
        {
            return bFilter.IsHave(val);
        }

        protected override bool AddValue(StringBloomFilter bFilter, string val)
        {
            return bFilter.Add(val);
        }

        protected override void FilterDispose(StringBloomFilter bFilter)
        {
            bFilter.Dispose();
        }
    }
}
